## install.packages("tidyjson")
library(dplyr)
library(tidyjson)
# p <- "/home/me/repo/work/n3c/hi.jsonl"
p <- "hi.jsonl"
## 1. read lines
l <- readLines(p)
## l

df <- l %>% spread_all
## 2. drop the ..JSON, and document.id columns
df <- df %>% tibble %>% select(-document.id, -..JSON)

## 3. get all cid=7
df7 <- df %>% filter(cid == 'cid-1')

# 4. get the last col
s <- df7[NROW(df7),]$logs
library(stringi)
stri_unescape_unicode(s)

# 5. save to file
writeLines(stri_unescape_unicode(s), "hi.txt")
